<!--
Copyright 2017 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<kd-object-meta
  [initialized]="isInitialized"
  [objectMeta]="networkPolicy?.objectMeta"
></kd-object-meta>

<kd-card [initialized]="isInitialized">
  <div
    title
    i18n
  >
    Resource information
  </div>
  <div
    content
    *ngIf="isInitialized"
    fxLayout="row wrap"
  >
    <kd-property *ngIf="networkPolicy?.podSelector">
      <div
        key
        i18n
      >
        Pod Selector
      </div>
      <div value>
        <kd-chips
          [map]="networkPolicy?.podSelector.matchLabels"
          [displayAll]="true"
        ></kd-chips>
      </div>
    </kd-property>

    <kd-property *ngIf="networkPolicy?.podSelector">
      <div
        key
        i18n
      >
        Policy Types
      </div>
      <div value>
        <kd-chips
          [map]="networkPolicy?.policyTypes"
          [displayAll]="true"
        ></kd-chips>
      </div>
    </kd-property>
  </div>
</kd-card>

<kd-card
  *ngIf="networkPolicy?.ingress"
  role="table"
>
  <div
    title
    i18n
  >
    Ingress Rules
  </div>
  <div content>
    <kd-text-input
      [text]="stringify(networkPolicy.ingress)"
      [readOnly]="true"
      [border]="false"
      mode="yaml"
    ></kd-text-input>
  </div>
</kd-card>

<kd-card
  *ngIf="networkPolicy?.egress"
  role="table"
>
  <div
    title
    i18n
  >
    Egress Rules
  </div>
  <div content>
    <kd-text-input
      [text]="stringify(networkPolicy.egress)"
      [readOnly]="true"
      [border]="false"
      mode="yaml"
    ></kd-text-input>
  </div>
</kd-card>
